/*
 * @Description: 
 * @Author: Aroma
 * @Date: 2024-09-27 15:35:56
 * @LastEditors: Aroma
 * @LastEditTime: 2024-09-27 15:42:02
 * @别瞎看: 你个无脑牛马
 */

import java.util.LinkedList;

/**
 * Test05LinkedList
 */
public class Test05LinkedList {

    public static void main(String[] args) {
        // 创建集合对象
        LinkedList<String> list=new LinkedList<String>();
        list.add("1");
        list.add("2");
        list.add("3");
        System.out.println(list);
        // 添加元素到头部和尾部
        list.addFirst("First");
        list.addLast("Last");
        System.out.println(list.getFirst());
        System.out.println(list.getLast());
        System.out.println(list);
        // 移除
        System.out.println(list.removeFirst());
        System.out.println(list.removeLast());
        System.out.println(list);
        // 移除并返回
        System.out.println(list.pop());
        System.out.println(list);

        System.out.println(list);
        list.push("pushElement");
        System.out.println();
    }
}